package models

import "time"

type MerchantStore struct {
	ID         int64     `gorm:"column:id" json:"id"`
	MerchantId int64     `gorm:"column:merchant_id" json:"merchant_id"`
	StoreId    int64     `gorm:"column:store_id" json:"store_id"`
	CreateTime time.Time `gorm:"column:create_time" json:"create_time"`
}

func (this *MerchantStore) GetMerchantIdByStoreId(storeId int64) int64 {
	db := Db
	db.Table("merchant_store").
		Where("store_id = ? ", storeId).
		Scan(this)
	return this.MerchantId
}

func (this *MerchantStore) GetStoreIdByMerchantId(MerchantId int64) int64 {
	db := Db
	db.Table("merchant_store").
		Where("merchant_id = ? ", MerchantId).
		Scan(this)
	return this.StoreId
}
